<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html>
<html>
	<head>
		<title>个人中心－举报记录</title>
	</head>
	<body>
	
		<!-- self_info -->
		<div class="grzxbj">
			<div class="selfinfo center">
				<div class="lfnav fl">
					<div class="ddzx">举报记录</div>
					<div class="subddzx">
						<ul>
							<li><a href="${pageContext.request.contextPath}/toMy/sell">出售中的商品</a></li>
							<li><a href="${pageContext.request.contextPath}/toMy/tradingSuccess">已出售的商品</a></li>
							<li><a href="${pageContext.request.contextPath}/toMy/trading">交易中的商品</a></li>
							<li><a href="${pageContext.request.contextPath}/toMy/shelves">已下架的商品</a></li>
						</ul>
					</div>
					<div class="ddzx">个人中心</div>
					<div class="subddzx">
						<ul>
							<li><a href="${pageContext.request.contextPath}/toMy/my">我的资料</a></li>
							<li><a href="${pageContext.request.contextPath}/toMy/notice">消息通知</a></li>
							<li><a href="${pageContext.request.contextPath}/toMy/rMessage">收到的留言</a></li>
							<li><a href="${pageContext.request.contextPath}/toMy/sMessage">发布的留言</a></li>
							<li><a href="${pageContext.request.contextPath}/toMy/criminalRecords">违规记录</a></li>
							<li><a href="${pageContext.request.contextPath}/toMy/report" style="color:#ff6700;font-weight:bold;">举报记录</a></li>
						</ul>
					</div>
				</div>
				<div class="rtcont fr">
					<div class="grzlbt ml40">
						举报记录
					</div>
					<c:if test="${(pagerModelGoodsReport.dates[0] != '' && pagerModelGoodsReport.dates[0] != null) || (PagerModelMessageReport.dates[0] != '' && PagerModelMessageReport.dates[0] != null)}">
						<div class="report-div">
							<!-- 左边 -->
							<div class="report-left">
								<h4>商品举报</h4>
								<c:forEach items="${pagerModelGoodsReport.dates}" var="pagerModelGoodsReport">
									<div class="layui-card report-card">
									  <div class="layui-card-header report-card-header">
									  	<span>状态：${pagerModelGoodsReport.goodsReportState}</span>
									  	<span>
									  		<a href="javascript:void(0)">查看</a>
									  		<input type="hidden" value="0-${pagerModelGoodsReport.goodsReportId}">
									  	</span>
									  </div>
									  <div class="layui-card-body report-card-body">
										    您于 ${pagerModelGoodsReport.goodsReportTime} 举报
										  <a href="${pageContext.request.contextPath}/goods/getGoodsListByUserId/${pagerModelGoodsReport.goodsAndUserVo.cshtUser.userId}" target="_blank">【${pagerModelGoodsReport.goodsAndUserVo.cshtUser.userUsername}】</a>
										  的商品【${pagerModelGoodsReport.goodsAndUserVo.goodsTitle}】存在【${pagerModelGoodsReport.goodsReportWhy}】问题我们已收到。我们会认真处理，维护平台良好的氛围，感谢您的反馈！
									  </div>
									</div>
								</c:forEach>
							</div><!-- 左边 -->
							<!-- 右边 -->
							<div class="report-right">
								<h4>留言举报</h4>
								<c:forEach items="${PagerModelMessageReport.dates}" var="PagerModelMessageReport">
									<div class="layui-card report-card">
									  <div class="layui-card-header report-card-header">
									  	<span>状态：${PagerModelMessageReport.messageReportState}</span>
									  	<span>
									  		<a href="javascript:void(0)">查看</a>
									  		<input type="hidden" value="1-${PagerModelMessageReport.messageReportId}">
									  	</span>
									  </div>
									  <div class="layui-card-body report-card-body">
										    您于 ${PagerModelMessageReport.messageReportTime} 举报
										  <a href="${pageContext.request.contextPath}/goods/getGoodsListByUserId/${PagerModelMessageReport.messageAndUserVo.cshtUser.userId}" target="_blank">【${PagerModelMessageReport.messageAndUserVo.cshtUser.userUsername}】</a>
										  的留言存在【${PagerModelMessageReport.messageReportWhy}】问题我们已收到。我们会认真处理，维护平台良好的氛围，感谢您的反馈！
									  </div>
									</div>
								</c:forEach>
							</div><!-- 右边 -->
						</div>
						<jsp:include page="../page/page.jsp">
							<jsp:param name="url" value="${pageContext.request.contextPath}/toMy/report"/>
							<jsp:param name="items" value="${PagerModelMessageReport.totalSize}"/>
							<jsp:param name="maxPageItems" value="${PagerModelMessageReport.messagePageSize}"/>
						</jsp:include>
					</c:if>
					
					<c:if test="${(pagerModelGoodsReport.dates[0] == '' || pagerModelGoodsReport.dates[0] == null) && (PagerModelMessageReport.dates[0] == '' || PagerModelMessageReport.dates[0] == null)}">
						<div class="null_tishi">
							<img src="${pageContext.request.contextPath}/static/image/null_tishi.gif">
							<p id="autoText">什么都没有…</p>
						</div>
					</c:if>
				</div>
				<div class="clear"></div>
			</div>
		</div>
		
		<!-- 举报记录详细模态框 -->
		<div class="modal fade" id="show-report-modal" tabindex="-1" role="dialog">
		  <div class="modal-dialog" role="document">
		    <div class="modal-content">
		      <div class="modal-header">
		        <h4 class="modal-title">类型</h4>
		      </div>
		      <div class="modal-body">
		        
		      </div>
		      <div class="modal-footer">
		        <button type="button" class="btn btn-default" id="notice-close-btn" data-dismiss="modal">关闭</button>
		      </div>
		    </div><!-- /.modal-content -->
		  </div><!-- /.modal-dialog -->
		</div><!-- 举报记录详细模态框 -->
		
		<script type="text/javascript">
			$(document).ready(function(){
				
				//点击查看举报记录
				$(".report-card-header a").on("click", function(){
					//加载提示
					$("#show-report-modal .modal-body p").html("<img src='${pageContext.request.contextPath}/static/image/loading.gif' style='margin-left:45%;'>加载中…");
					$("#show-report-modal").modal("show");
					//参数格式"0-0",第一个数字"0"表示是商品举报类型，"1"表示是留言举报类型；第二个数字表示id编号
					var typeAndId = $(this).siblings("input[type='hidden']").val();
					$.ajax({
						url: "${pageContext.request.contextPath}/toMy/getReportById",
						type: "POST",
						dataType: "JSON",
						data: {
							"typeAndId": typeAndId,
						},
						success: function(data){
							if(data.reportType == "goodsReport"){
								var htmlTitle = "商品举报记录";
								var htmlBody = "";
								htmlBody += "<p>您于 " + data.cshtGoodsReportVo.goodsReportTime + " 举报";
								htmlBody += "<b style='color:#337ab7'>【" + data.cshtGoodsReportVo.goodsAndUserVo.cshtUser.userUsername + "】</b>";
								htmlBody += "的商品<b>【" + data.cshtGoodsReportVo.goodsAndUserVo.goodsTitle + "】</b>" + "存在<b>【" + data.cshtGoodsReportVo.goodsReportWhy + "】</b>";
								htmlBody += "问题我们已收到。我们会认真处理，维护平台良好的氛围，感谢您的反馈！</p>";
								htmlBody += "<p style='text-align:right'>状态：<b>" + data.cshtGoodsReportVo.goodsReportState + "</b></p>";
								htmlBody += "<p style='text-align:right'>处理结果：<b>" + data.cshtGoodsReportVo.goodsReportResults + "</b></p>";
								$("#show-report-modal .modal-title").text(htmlTitle);
								$("#show-report-modal .modal-body").html(htmlBody);
							}else if(data.reportType == "messageReport"){
								var htmlTitle = "留言举报记录";
								var htmlBody = "";
								htmlBody += "<p>您于 " + data.cshtMessageReportVo.messageReportTime + " 举报";
								htmlBody += "<b style='color:#337ab7'>【" + data.cshtMessageReportVo.messageAndUserVo.cshtUser.userUsername + "】</b>";
								htmlBody += "的留言存在<b>【" + data.cshtMessageReportVo.messageReportWhy+ "】</b>问题我们已收到。我们会认真处理，维护平台良好的氛围，感谢您的反馈！</p>";
								htmlBody += "<p style='text-align:right'>状态：<b>" + data.cshtMessageReportVo.messageReportState + "</b></p>";
								htmlBody += "<p style='text-align:right'>处理结果：<b>" + data.cshtMessageReportVo.messageReportResults + "</b></p>";
								$("#show-report-modal .modal-title").text(htmlTitle);
								$("#show-report-modal .modal-body").html(htmlBody);
							}else{
								layer.msg("查询出错，请反馈给管理员！");
							}
						}
					});
				})
				
				
				/*跳跳字体动画
				 *  参数详解:
				 *	upTime			上移的时间
				 *	downTime		下落的时间
				 *	beatHeight		上移高度
				 *	isAuth			是否自动
				 *	isRotate		是否旋转
				*/
				$('p#autoText').beatText({isAuth:true,beatHeight:"1.5em",isRotate:false});

			})
		</script>
		
		
	</body>
</html>